<template>
  <div class="container">
    <!-- 装饰元素 -->
    <div class="decoration circle"></div>
    <div class="decoration wave"></div>

    <!-- 主卡片 -->
    <div class="card">
      <h1>亲爱的朋友</h1>

      <p>你好呀！此刻，无论你是出于好奇还是想更了解自己的内心，这份自测题都像一位安静的朋友，在这里陪伴你梳理最近的感受。</p>

      <p style="text-indent: 2em">每个人的情绪都像一片独特的海洋，时而平静，时而泛起涟漪——这再正常不过。下面的问题没有对错之分，不代表对你的评价，它更像一面温柔的<span
          class="highlight">"情绪晴雨表"</span>，帮你觉察自己的心理能量是否需要更多关怀。</p>

      <p style="text-indent: 2em">请根据最近1个月的真实状态，选择最贴近你感受的选项。答案的分数只是起点，而你的感受永远值得被认真倾听。如果有些问题让你犹豫，不妨深吸一口气，对自己说：<span
          class="highlight">"我的诚实，已经足够勇敢。"</span></p>

      <div class="btn-container">
        <RouterLink to="/examination">
          <button id="start-btn">开始测试</button>
        </RouterLink>
      </div>
    </div>
  </div>
</template>
<script setup>
import {onMounted} from "vue";

onMounted(() => {
  // 动态粒子效果
  function createParticles() {
    const colors = ['hsl(25deg 85% 70% / 0.2)', 'hsl(320deg 50% 70% / 0.2)'];

    for (let i = 0; i < 30; i++) {
      const particle = document.createElement('div');
      particle.classList.add('particle');

      const size = Math.random() * 5 + 2;
      const duration = Math.random() * 15 + 10;
      const delay = Math.random() * 5;

      particle.style.cssText = `
                    position: fixed;
                    width: ${size}px;
                    height: ${size}px;
                    background: ${colors[Math.floor(Math.random() * colors.length)]};
                    border-radius: 50%;
                    pointer-events: none;
                    z-index: -1;
                    top: ${Math.random() * 100}%;
                    left: ${Math.random() * 100}%;
                    animation: float ${duration}s linear ${delay}s infinite;
                `;

      document.body.appendChild(particle);
    }
  }

  // 粒子浮动动画
  const style = document.createElement('style');
  style.textContent = `
    @keyframes float {
      0% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0;
      }
      10% {
        opacity: 0.3;
      }
      90% {
        opacity: 0.3;
      }
      100% {
        transform: translate(${Math.random() * 200 - 100}px, ${Math.random() * 200 - 100}px) rotate(${Math.random() * 360}deg);
        opacity: 0;
      }
    }
  `;
  document.head.appendChild(style);

  // 页面加载后初始化
  window.addEventListener('DOMContentLoaded', () => {
    createParticles();

    // 按钮点击效果
    const btn = document.getElementById('start-btn');
    btn.addEventListener('click', () => {
      // 这里可以添加点击后的交互效果
      console.log('测试开始');
    });
  });
})
</script>
<style scoped>
/* 基础重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* 动态渐变背景（匹配图片色调） */
.container {
  min-height: 100vh;
  background: linear-gradient(
      135deg,
      hsl(25deg 85% 85% / 0.9), /* 浅橙色 */ hsl(320deg 50% 85% / 0.9) /* 浅紫色 */
  );
  background-size: 200% 200%;
  animation: gradientBG 12s ease infinite;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  position: relative;
  overflow-x: hidden;
  user-select: none;
}

@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* 背景纹理增强 */
.container::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle, transparent 20%, hsl(0deg 0% 100% / 0.03) 20%);
  background-size: 15px 15px;
  pointer-events: none;
  z-index: -1;
}

/* 主内容卡片（匹配图片布局） */
.card {
  background: hsl(0deg 0% 100% / 0.92);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  padding: 40px;
  max-width: 800px;
  width: 100%;
  box-shadow: 0 12px 24px hsl(320deg 30% 30% / 0.1),
  0 2px 6px hsl(25deg 70% 60% / 0.1);
  position: relative;
  overflow: hidden;
}

/* 卡片装饰元素 */
.card::after {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, hsl(25deg 85% 85% / 0.15) 0%, transparent 50%);
  z-index: -1;
}

/* 标题样式 */
h1 {
  color: hsl(320deg 50% 40%);
  font-size: 2rem;
  margin-bottom: 1.5rem;
  font-weight: 600;
  text-align: center;
  position: relative;
  display: inline-block;
  left: 50%;
  transform: translateX(-50%);
}

h1::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, hsl(25deg 85% 70%), hsl(320deg 50% 70%));
  border-radius: 3px;
}

/* 段落文本 */
p {
  color: hsl(0deg 0% 25%);
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
  text-align: justify;
  position: relative;
  padding-left: 1.5rem;
}

/* 首字下沉效果 */
p:first-of-type::first-letter {
  font-size: 2.5rem;
  color: hsl(25deg 85% 60%);
  float: left;
  line-height: 1;
  margin-right: 8px;
  margin-top: 4px;
  font-weight: 500;
}

/* 重点强调文本 */
.highlight {
  color: hsl(320deg 60% 40%);
  font-weight: 500;
  text-shadow: 0 0 1px hsl(320deg 50% 80% / 0.5);
}

/* 按钮样式 */
.btn-container {
  text-align: center;
  margin-top: 2rem;
}

#start-btn {
  background: linear-gradient(135deg, hsl(25deg 85% 65%), hsl(320deg 50% 60%));
  color: white;
  border: none;
  padding: 16px 40px;
  font-size: 1.2rem;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 12px hsl(320deg 50% 50% / 0.3),
  inset 0 1px 1px hsl(0deg 0% 100% / 0.4);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  font-weight: 500;
}

#start-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px hsl(320deg 50% 50% / 0.4),
  inset 0 1px 1px hsl(0deg 0% 100% / 0.4);
}

#start-btn:active {
  transform: translateY(1px);
}

/* 按钮光效 */
#start-btn::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
      to bottom right,
      hsl(0deg 0% 100% / 0) 45%,
      hsl(0deg 0% 100% / 0.3) 50%,
      hsl(0deg 0% 100% / 0) 55%
  );
  transform: rotate(30deg);
  animation: shine 3s infinite;
}

@keyframes shine {
  0% {
    transform: translateX(-100%) rotate(30deg);
  }
  100% {
    transform: translateX(100%) rotate(30deg);
  }
}

/* 装饰元素 */
.decoration {
  position: absolute;
  opacity: 0.1;
  z-index: -1;
}

.decoration.circle {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(25deg 85% 70%), hsl(320deg 50% 70%));
  top: -50px;
  left: -50px;
}

.decoration.wave {
  bottom: 0;
  right: 0;
  width: 100%;
  height: 20px;
  background: url('data:image/svg+xml;utf8,<svg viewBox="0 0 1200 120" xmlns="http://www.w3.org/2000/svg" fill="%23ffffff"><path d="M0,0V46.29c47.79,22.2,103.59,32.17,158,28,70.36-5.37,136.33-33.31,206.8-37.5C438.64,32.43,512.34,53.67,583,72.05c69.27,18,138.3,24.88,209.4,13.08,36.15-6,69.85-17.84,104.45-29.34C989.49,25,1113-14.29,1200,52.47V0Z" opacity=".25"/><path d="M0,0V15.81C13,36.92,27.64,56.86,47.69,72.05,99.41,111.27,165,111,224.58,91.58c31.15-10.15,60.09-26.07,89.67-39.8,40.92-19,84.73-46,130.83-49.67,36.26-2.85,70.9,9.42,98.6,31.56,31.77,25.39,62.32,62,103.63,73,40.44,10.79,81.35-6.69,119.13-24.28s75.16-39,116.92-43.05c59.73-5.85,113.28,22.88,168.9,38.84,30.2,8.66,59,6.17,87.09-7.5,22.43-10.89,48-26.93,60.65-49.24V0Z" opacity=".5"/><path d="M0,0V5.63C149.93,59,314.09,71.32,475.83,42.57c43-7.64,84.23-20.12,127.61-26.46,59-8.63,112.48,12.24,165.56,35.4C827.93,77.22,886,95.24,951.2,90c86.53-7,172.46-45.71,248.8-84.81V0Z"/></svg>');
  background-size: cover;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .card {
    padding: 30px 20px;
    border-radius: 16px;
  }

  h1 {
    font-size: 1.8rem;
  }

  p {
    font-size: 1rem;
    padding-left: 1rem;
  }

  #start-btn {
    padding: 14px 32px;
    font-size: 1.1rem;
  }
}
</style>
  